home *** CD-ROM | disk | FTP | other *** search
- /*
- * MWMaca.h - MacWrite document structures, version 4.5
- * (actually, lots of this is for version 2.2, I was never took it out.)
- *
- * The comments below are mostly non-edifying. A copy of
- * Macintosh Technical Note 12 is a necessity, as it
- * describes document formats in detail.
- *
- * One difference is that the "active face" in the window variables
- * is really a point size (high byte) and style (low byte), not just
- * a style.
- */
-
-
- # ifndef _MWMaca_
- # define _MWMaca_
-
-
- typedef enum /* supported versions of MacWrite */
- {
- version3 = 3, /* MacWrite 2.2 */
- version6 = 6 /* MacWrite 4.5 */
- };
-
-
- typedef enum /* document types */
- {
- mainDoc = 0,
- headDoc = 1,
- footDoc = 2
- };
-
-
- typedef enum /* paragraph types */
- {
- rulerPara = 0,
- textPara = 1,
- pictPara = 2
- };
-
-
- typedef enum /* justification types */
- {
- leftJust = 0,
- centerJust = 1,
- rightJust = 2,
- fillJust = 3
- } Justification;
-
-
- /*
- * Types common to all versions
- */
-
- typedef Byte ByteBool; /* byte-size boolean */
- typedef Byte UPrintRec[120]; /* 120-byte universal printing record */
- /* (anyone know what's in it?) */
-
-
- typedef struct Selection
- {
- short selPara; /* selection paragraph number */
- short selPos; /* selection char position (start or end) */
- } Selection;
-
-
- typedef struct ActiveFace
- {
- Byte faceSize; /* point size */
- Byte faceStyle; /* style */
- } ActiveFace;
-
-
- typedef struct Format
- {
- short fmtPos; /* pos of first char format applies to */
- Byte fmtSize; /* point size */
- Byte fmtStyle; /* style */
- short fmtFont; /* font number */
- } Format;
-
- typedef Format FormatArray[1]; /* actually variable length */
- typedef FormatArray **FAHandle;
-
-
- typedef struct Ruler
- {
- short margLeft; /* left margin */
- short margRight; /* right margin */
- Justification just; /* justification */
- Byte nTabs; /* number of tabs */
- short spacing; /* line spacing = 1 + (spacing/2) */
- short indent; /* indentation of first line */
- short tab[10]; /* tab values */
- Byte fill[4]; /* unused */
- } Ruler;
-
-
- /*
- * MacWrite 2.2 (version number 3) data structures
- */
-
-
- typedef struct Globals3 /* version 2.2 globals */
- {
- short version; /* version number (always 3) */
- short paraOffset; /* offset to paragraph information */
- short mainParas; /* main doc paragraph count */
- short headParas; /* header paragraph count */
- short footParas; /* footer paragraph count */
- ByteBool titlePage; /* title page flag */
- Byte fill[2]; /* unused */
- ByteBool showFoot; /* true if footer displayed */
- ByteBool showHead; /* true if header displayed */
- ByteBool showRuler; /* true if rulers displayed */
- short activeDoc; /* active document */
- short startPage; /* starting page number */
- } Globals3;
-
-
- typedef struct ParaInfo3
- {
- short paraHeight; /* height of paragraph (pixels) */
- short paraPos; /* position from top of page */
- Byte paraPage; /* page number */
- Byte fill[3]; /* unused */
- } ParaInfo3;
-
-
- typedef struct Windows3 /* version 2.2 window variables */
- {
- Selection selStart; /* start of selection */
- Selection selEnd; /* end of selection */
- short vertOffset; /* vertical offset */
- short redrawPara; /* first paragraph to redraw */
- Point pageIconPt; /* page icon position */
- Point dateIconPt; /* date icon position */
- Point timeIconPt; /* time icon position */
- Byte fill[4]; /* unused */
- ByteBool iconRedraw; /* true if icons should be redrawn */
- ByteBool iconFlag; /* true if rulers shown when icons last drawn */
- short activeFont; /* font active when saved */
- ActiveFace activeFace; /* face active when saved */
- } Windows3;
-
-
- typedef struct DocInfo3 /* version 2.2 document information */
- {
- Globals3 globals3; /* globals */
- UPrintRec uPrintRec; /* universal printing record */
- Windows3 mainWind3; /* main doc window information */
- Windows3 headWind3; /* header window information */
- Windows3 footWind3; /* footer window information */
- } DocInfo3;
-
-
- /*
- * MacWrite 4.5 (version number 6) data structures
- */
-
-
- typedef struct Globals6 /* version 4.5 globals */
- {
- short version; /* version number (always 6) */
- short mainParas; /* main doc paragraph count */
- short headParas; /* header paragraph count */
- short footParas; /* footer paragraph count */
- ByteBool titlePage; /* title page flag */
- Byte fill; /* unused */
- ByteBool showScrap; /* true if scrap displayed */
- ByteBool showFoot; /* true if footer displayed */
- ByteBool showHead; /* true if header displayed */
- ByteBool showRuler; /* true if rulers displayed */
- short activeDoc; /* active document */
- short startPage; /* starting page number */
- long freePos; /* free list position */
- short freeLen; /* free list length */
- short freeAlloc; /* bytes allocated for free list on disk */
- Byte fill2[14]; /* unused */
- } Globals6;
-
-
- typedef enum /* status byte bitmasks */
- {
- stJustMask = 0x03, /* justification code */
- stInUse = 0x04, /* bit set if paragraph is in use */
- stCompress = 0x08, /* bit set if text is compressed */
- stOnItsWay = 0x10, /* bit set if disk i/o started, not done */
- stInMemory = 0x20, /* bit set if paragraph is in memory */
- stJustify = 0x40, /* bit set if just code above used */
- /* otherwise use ruler */
- stDirty = 0x80 /* set if paragraph is dirty */
- };
-
-
- typedef enum /* justification codes relating to stJustMask */
- {
- stJustLeft = 0x00,
- stJustCenter = 0x01,
- stJustRight = 0x02,
- stJustFull = 0x03
- };
-
-
- typedef union ParaStOff
- {
- Byte paraStatus; /* paragraph status */
- long paraOffset; /* position of paragraph data */
- /* (low 3 bytes only) */
- } ParaStOff;
-
-
- typedef struct ParaInfo6
- {
- short paraHeight; /* height of paragraph (pixels) */
- short paraPos; /* position from top of page */
- long paraHandle; /* handle to paragraph */
- ParaStOff paraStOff; /* data position/status */
- short paraLen; /* length of paragraph data */
- short paraFmts; /* common formats */
- } ParaInfo6;
-
- typedef ParaInfo6 ParaInfoArray6[1]; /* actually variable length */
- typedef ParaInfoArray6 **PIAHandle;
-
-
- typedef struct Windows6 /* version 4.5 window variables */
- {
- Selection selStart; /* start of selection */
- Selection selEnd; /* end of selection */
- short vertOffset; /* vertical offset */
- short redrawPara; /* first paragraph to redraw */
- long infoPos; /* position of information array */
- short infoLen; /* length of information array */
- long linePos; /* position of line height array */
- short lineLen; /* length of line height array */
- Point pageIconPt; /* page icon position */
- Point dateIconPt; /* date icon position */
- Point timeIconPt; /* time icon position */
- Byte fill[4]; /* unused */
- ByteBool iconRedraw; /* true if ovals (icons) should be redrawn */
- ByteBool iconFlag; /* true if rulers shown when ovals last drawn */
- ActiveFace activeFace; /* face active when saved */
- short activeFont; /* font active when saved */
- } Windows6;
-
-
- typedef struct DocInfo6 /* version 4.5 document information */
- {
- Globals6 globals6; /* globals */
- UPrintRec uPrintRec; /* universal printing record */
- Windows6 footWind6; /* footer window information */
- Windows6 headWind6; /* header window information */
- Windows6 mainWind6; /* main doc window information */
- } DocInfo6;
-
- # endif
-